We have carried out a survey of optically-selected dark clouds using the bolometer array SCUBA on the James Clerk Maxwell Telescope, at 850 microns wavelength. The survey covers a total of 0.5 square degrees and is unbiased with reference to cloud size, star formation activity, or the presence of infrared emission. Several new protostars and starless cores have been discovered; the protostars are confirmed through the detection of their accompanying outflows in CO(2-1) emission. The survey is believed to be complete for Class 0 and Class I protostars, and yields two important results regarding the lifetimes of these phases. First, the ratio of Class 0 to Class protostars in the sample is roughly unity, very different from the 1:10 ratio that has previously been observed for the rho Ophiuchi star-forming region. Assuming star formation to be a homogeneous process in the dark clouds, this implies that the Class 0 lifetime is similar to the Class I phase, which from infrared surveys has been established to be approximately 200,000 yr. It also suggests there is no rapid initial accretion phase in Class 0 objects. A burst of triggered star formation some 100,000 yr ago can explain the earlier results for rho Ophiuchus. Second, the number of starless cores is approximately twice that of the total number of protostars, indicating a starless core lifetime of approximately 800,000 yr. These starless cores are therefore very short-lived, surviving only two or three free-fall times. This result suggests that, on size scales of 10,000 AU at least, the dynamical evolution of starless cores is probably not controlled by magnetic processes.